package model.user;

/**
 * The user class contains the information of the users of the 
 * Royally Flushed system as found in the database.
 * It contains the user's login details.
 * The user settings, user statistics and user bank are objects that contain the
 * appropriate information for that specific user.
 */

import java.io.Serializable;

public class User implements Serializable {
	private static final long serialVersionUID = 1L;
	
	// Login details
	private String username;
	private String password;
	private UserSettings userSettings;
	private UserStatistics userStatistics;
	private UserBank userBank;
	
	/**
	 * The user's gender is represented as an enum of either MALE or FEMALE
	 */
	public enum Gender {
		MALE("male"), FEMALE("female");
		
		private final String stringValue;
		
		Gender (String stringValue){
			this.stringValue = stringValue;
		}
		
		public String getStringValue(){
			return stringValue;
		}
	}
	
	/**
	 * Each user has a ranking depending on the amount of experience points the 
	 * user has accumulated.
	 */
	public enum Ranking {
		SCRUB("SCRUB", "NEWBIE", 400), NEWBIE("NEWBIE", "NOVICE", 900), NOVICE("NOVICE", "AMATEUR", 1400), AMATEUR("AMATEUR", "SEASONED", 2100), SEASONED("SEASONED", "SKILLED", 2800), SKILLED("SKILLED", "SEMIPRO", 3600), SEMIPRO("SEMIPRO", "ADEPT", 4500), ADEPT("ADEPT", "PRO", 5400), PRO("PRO", "MASTER", 6500), MASTER("MASTER", "STUD", 10000), STUD("STUD", "", -1);
		
		private final String rank;
		private final String nextRank;
		private final int nextLevelPoints;

		Ranking (String rank, String nextRank, int nextLevelPoints) {
			this.rank = rank;
			this.nextRank = nextRank;
			this.nextLevelPoints = nextLevelPoints;
		}
				
		public int getNextLevelPoints() {
			return nextLevelPoints;
		}
		
		public String getRank(){
			return rank;
		}

		public String getNextRank() {
			return nextRank;
		}				
	}
		
	/**
	 * Constructor, create new user object from the given information
	 */
	public User(String username, String password, UserSettings userSettings, UserStatistics userStatistics, UserBank userBank) {
		this.username = username;
		this.password = password;
		this.userSettings = userSettings;
		this.userStatistics = userStatistics;
		this.userBank = userBank;
		
	}
	
	//Getters and setters
	
	public UserSettings getUserSettings() {
		return userSettings;
	}
	
	public UserStatistics getUserStatistics() {
		return userStatistics;
	}
	
	public UserBank getUserBank() {
		return userBank;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	
}
